<template>
    <el-button type="text" @click="handleClick">删除</el-button>
</template>
<script>

export default {
  name: 'TableDeleteButton',
  inject: ['editorIndex', 'index', 'store'],
  methods: {
    // 本地删除
    handleClick(){
      this.store.data.splice(this.index, 1);
      // console.log(this.row, this.index, this.store.data);

      // 避免因删除 导致editorIndex数组下标越界
      this.editorIndex.forEach((item, index) => {
        if (index >= this.index) {
          this.editorIndex[index] = this.editorIndex[index + 1]
        }
    })
    }
  }
}
</script>